import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/layout'
import menuIcons from '@/assets/menuIcons'
export const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login'),
  },
]
export const asyncRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/home',
    meta: {
      title: '首页',
      isShow: true,
      isHome: true,
      icon: 'MenuOutlined',
    },
    component: Layout,
    children: [
      {
        path: '/home',
        name: 'home',
        meta: {
          title: '首页',
        },
        component: () => import('@/views/HomeView'),
      },
    ],
  },
  {
    path: '/maps',
    redirect: '/map',
    meta: {
      title: '地图',
      isShow: true,
    },
    component: Layout,
    children: [
      {
        path: '/map',
        name: 'map',
        meta: {
          title: '地图',
          isShow: true,
        },
        component: () => import('@/views/map'),
      },
    ],
  },
  {
    path: '/logs',
    redirect: '/loginLog',
    meta: {
      title: '日志管理',
      isShow: true,
    },
    component: Layout,
    children: [
      {
        path: '/loginLog',
        name: 'loginLog',
        meta: {
          title: '登录日志',
          isShow: true,
        },
        component: () => import('@/views/logManage/loginLog'),
      },
      {
        path: '/optionalLog',
        name: 'optionalLog',
        meta: {
          title: '操作日志',
          isShow: true,
        },
        component: () => import('@/views/logManage/optionalLog'),
      },
    ],
  },
]
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: constantRoutes,
})

export default router
